package org.tgit.gateway.domain;

import java.util.HashSet;
import java.util.Set;

import org.springframework.util.StringUtils;


/**
 * 存储到网关缓存中的API信息对象
 * @author fanzaijun
 * 2017年6月27日
 */
public class ApiGateWayInfo {
    // APIID
    private String apiId;
    // 访问URI
    private String accessUri;
    // 部署URI
    private String deployUri;
    // 部署请求方式
    private String method;
    // 最大并发量
    private long maxConcurrency;
    // 当前API在校内的状态
    private int status = 0;
    // 部署服务器
    private Set<String> deployServers;
    // 部署服务器
    private Set<String> deployHost;
    
    public String getApiId() {
        return apiId;
    }
    public void setApiId(String apiId) {
        this.apiId = apiId;
    }
    public long getMaxConcurrency() {
        return maxConcurrency;
    }
    public void setMaxConcurrency(long maxConcurrency) {
        this.maxConcurrency = maxConcurrency;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getAccessUri() {
        return accessUri;
    }
    public void setAccessUri(String accessUri) {
        this.accessUri = accessUri;
    }
    public Set<String> getDeployServers() {
        return deployServers;
    }
    public void setDeployServers(Set<String> deployServers) {
        this.deployServers = deployServers;
    }
    
    // 增加部署的URI
    public void addDeployServer(String server){
        if (StringUtils.isEmpty(this.deployServers)){
            this.deployServers = new HashSet<String>();
        }
        this.deployServers.add(server);
    }
    // 增加部署的host
    public void addDeployHost(String host){
    	if (StringUtils.isEmpty(this.deployHost)){
    		this.deployHost = new HashSet<String>();
    	}
    	this.deployHost.add(host);
    }
	public Set<String> getDeployHost() {
		return deployHost;
	}
	public void setDeployHost(Set<String> deployHost) {
		this.deployHost = deployHost;
	}
	public String getDeployUri() {
		return deployUri;
	}
	public void setDeployUri(String deployUri) {
		this.deployUri = deployUri;
	}
	public String getMethod() {
		return method;
	}
	public void setMethod(String method) {
		this.method = method;
	}
    
}
